package com.db.curd;


import java.sql.Connection;
import java.sql.SQLException;
 
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
 
@Deprecated
public class DBtool {
    /**
     * 连接池工具
     * @return
     */
    public static Connection getConnection(){
        try {
            InitialContext ictx=new InitialContext();
            DataSource ds=(DataSource) ictx.lookup("java:comp/env/jdbc/mysql");
            return ds.getConnection();
        } catch (NamingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return null;
    }
}
